<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Victor
 * Date: 22.11.11
 * Time: 0:05
 * To change this template use File | Settings | File Templates.
 */

class Core_Registry
{
    private static $instance = null;
    private $data = array();


    private function __construct()
    {

    }

    static function getInstance()
    {
        if (self::$instance != null) {
            self::$instance = new Core_Registry();
        }
        return self::$instance;
    }

    private function __set($name, $variable)
    {
        $this->data[$name] = $variable;

    }

    private function __get($name)
    {
        if (array_key_exists($name, $this->data)) {
            return $this->data[$name];
        } else
            throw new Exception("Class:Core_Registry. Variable:" . $name . " not set !");
    }
}
